#include "widget.h"
#include <QVBoxLayout>
#include <QMessageBox>


Widget::Widget(QWidget *parent)
    : CFrameLessWidgetBase(parent)
{

    initUI();
}

Widget::~Widget()
{

}

void Widget::on_closeSlot()
{
    QMessageBox::StandardButton _exit = QMessageBox::warning(this, "提示", "确定要退出嘛", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);

    if(_exit == QMessageBox::Yes)
    {
        close();
    }


}
void Widget::initUI()
{
    //this->setStyleSheet("background-color:rgb(54,54,54)");

    m_pTitleBar = new CTitleBar(this);

    QWidget* w = new QWidget(this);
    w->setMinimumSize(800, 600);


    QVBoxLayout* pVlay = new QVBoxLayout(this);
    pVlay->addWidget(m_pTitleBar);
    pVlay->addWidget(w);

    pVlay->setContentsMargins(0,0,0,0);
    setLayout(pVlay);

    connect(m_pTitleBar, &CTitleBar::sig_close,this, &Widget::on_closeSlot);
}
